package org.mozhu.mboot.admin.system.resource.entity;

import com.google.common.collect.Lists;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 界面是那个使用的菜单对象
 */
@Data
public class Menu implements Serializable {
    private static final long serialVersionUID = 5534419110064365244L;
    private Long id;
    private String code;
    private String name;
    private String enName;
    private String icon;
    private String url;

    private List<Menu> children;

    public Menu() {
    }

    public Menu(Long id, String code, String name, String enName, String icon, String url) {
        super();
        this.id = id;
        this.code = code;
        this.name = name;
        this.enName = enName;
        this.icon = icon;
        this.url = url;
    }

    public List<Menu> getChildren() {
        if (children == null) {
            children = Lists.newArrayList();
        }
        return children;
    }

    public boolean isHasChildren() {
        return !getChildren().isEmpty();
    }

}
